3.238 \(\int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx\)

Optimal. Leaf size=87 \[ \frac{\left (a^2-2 b^2\right ) \sin (c+d x)}{3 d}-\frac{a b \sin (c+d x) \cos (c+d x)}{3 d}-\frac{\sin (c+d x) (a \cos (c+d x)+b)^2}{3 d}+a b x+\frac{b^2 \tanh ^{-1}(\sin (c+d x))}{d} \]

[Out]

a*b*x + (b^2*ArcTanh[Sin[c + d*x]])/d + ((a^2 - 2*b^2)*Sin[c + d*x])/(3*d) - (a*b*Cos[c + d*x]*Sin[c + d*x])/(
3*d) - ((b + a*Cos[c + d*x])^2*Sin[c + d*x])/(3*d)

________________________________________________________________________________________

Rubi [A]  time = 0.321384, antiderivative size = 87, normalized size of antiderivative = 1., number of steps used = 7, number of rules used = 7, integrand size = 26, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.269, Rules used = {4397, 2889, 3050, 3033, 3023, 2735, 3770} \[ \frac{\left (a^2-2 b^2\right ) \sin (c+d x)}{3 d}-\frac{a b \sin (c+d x) \cos (c+d x)}{3 d}-\frac{\sin (c+d x) (a \cos (c+d x)+b)^2}{3 d}+a b x+\frac{b^2 \tanh ^{-1}(\sin (c+d x))}{d} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]*(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]

[Out]

a*b*x + (b^2*ArcTanh[Sin[c + d*x]])/d + ((a^2 - 2*b^2)*Sin[c + d*x])/(3*d) - (a*b*Cos[c + d*x]*Sin[c + d*x])/(
3*d) - ((b + a*Cos[c + d*x])^2*Sin[c + d*x])/(3*d)

Rule 4397

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rule 2889

Int[cos[(e_.) + (f_.)*(x_)]^2*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)
, x_Symbol] :> Int[(d*Sin[e + f*x])^n*(a + b*Sin[e + f*x])^m*(1 - Sin[e + f*x]^2), x] /; FreeQ[{a, b, d, e, f,
 m, n}, x] && NeQ[a^2 - b^2, 0] && (IGtQ[m, 0] || IntegersQ[2*m, 2*n])

Rule 3050

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (C_.)
*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> -Simp[(C*Cos[e + f*x]*(a + b*Sin[e + f*x])^m*(c + d*Sin[e + f*x])^(n
 + 1))/(d*f*(m + n + 2)), x] + Dist[1/(d*(m + n + 2)), Int[(a + b*Sin[e + f*x])^(m - 1)*(c + d*Sin[e + f*x])^n
*Simp[a*A*d*(m + n + 2) + C*(b*c*m + a*d*(n + 1)) + (A*b*d*(m + n + 2) - C*(a*c - b*d*(m + n + 1)))*Sin[e + f*
x] + C*(a*d*m - b*c*(m + 1))*Sin[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, C, n}, x] && NeQ[b*c -
a*d, 0] && NeQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && GtQ[m, 0] &&  !(IGtQ[n, 0] && ( !IntegerQ[m] || (EqQ[a, 0
] && NeQ[c, 0])))

Rule 3033

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)])*((A_.) + (B_.)*sin[(e
_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> -Simp[(C*d*Cos[e + f*x]*Sin[e + f*x]*(a + b
*Sin[e + f*x])^(m + 1))/(b*f*(m + 3)), x] + Dist[1/(b*(m + 3)), Int[(a + b*Sin[e + f*x])^m*Simp[a*C*d + A*b*c*
(m + 3) + b*(B*c*(m + 3) + d*(C*(m + 2) + A*(m + 3)))*Sin[e + f*x] - (2*a*C*d - b*(c*C + B*d)*(m + 3))*Sin[e +
 f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] &&
!LtQ[m, -1]

Rule 3023

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (
f_.)*(x_)]^2), x_Symbol] :> -Simp[(C*Cos[e + f*x]*(a + b*Sin[e + f*x])^(m + 1))/(b*f*(m + 2)), x] + Dist[1/(b*
(m + 2)), Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Sin[e + f*x], x], x]
, x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] &&  !LtQ[m, -1]

Rule 2735

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*x)/d
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \cos (c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx &=\int (b+a \cos (c+d x))^2 \sin (c+d x) \tan (c+d x) \, dx\\ &=\int (b+a \cos (c+d x))^2 \left (1-\cos ^2(c+d x)\right ) \sec (c+d x) \, dx\\ &=-\frac{(b+a \cos (c+d x))^2 \sin (c+d x)}{3 d}+\frac{1}{3} \int (b+a \cos (c+d x)) \left (3 b+a \cos (c+d x)-2 b \cos ^2(c+d x)\right ) \sec (c+d x) \, dx\\ &=-\frac{a b \cos (c+d x) \sin (c+d x)}{3 d}-\frac{(b+a \cos (c+d x))^2 \sin (c+d x)}{3 d}+\frac{1}{6} \int \left (6 b^2+6 a b \cos (c+d x)+2 \left (a^2-2 b^2\right ) \cos ^2(c+d x)\right ) \sec (c+d x) \, dx\\ &=\frac{\left (a^2-2 b^2\right ) \sin (c+d x)}{3 d}-\frac{a b \cos (c+d x) \sin (c+d x)}{3 d}-\frac{(b+a \cos (c+d x))^2 \sin (c+d x)}{3 d}+\frac{1}{6} \int \left (6 b^2+6 a b \cos (c+d x)\right ) \sec (c+d x) \, dx\\ &=a b x+\frac{\left (a^2-2 b^2\right ) \sin (c+d x)}{3 d}-\frac{a b \cos (c+d x) \sin (c+d x)}{3 d}-\frac{(b+a \cos (c+d x))^2 \sin (c+d x)}{3 d}+b^2 \int \sec (c+d x) \, dx\\ &=a b x+\frac{b^2 \tanh ^{-1}(\sin (c+d x))}{d}+\frac{\left (a^2-2 b^2\right ) \sin (c+d x)}{3 d}-\frac{a b \cos (c+d x) \sin (c+d x)}{3 d}-\frac{(b+a \cos (c+d x))^2 \sin (c+d x)}{3 d}\\ \end{align*}

Mathematica [A]  time = 0.152097, size = 117, normalized size = 1.34 \[ \frac{3 \left (a^2-4 b^2\right ) \sin (c+d x)+a^2 (-\sin (3 (c+d x)))-6 a b \sin (2 (c+d x))+12 a b c+12 a b d x-12 b^2 \log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sin \left (\frac{1}{2} (c+d x)\right )\right )+12 b^2 \log \left (\sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )}{12 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]*(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]

[Out]

(12*a*b*c + 12*a*b*d*x - 12*b^2*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + 12*b^2*Log[Cos[(c + d*x)/2] + Sin[(
c + d*x)/2]] + 3*(a^2 - 4*b^2)*Sin[c + d*x] - 6*a*b*Sin[2*(c + d*x)] - a^2*Sin[3*(c + d*x)])/(12*d)

________________________________________________________________________________________

Maple [A]  time = 0.052, size = 83, normalized size = 1. \begin{align*}{\frac{{a}^{2} \left ( \sin \left ( dx+c \right ) \right ) ^{3}}{3\,d}}-{\frac{ab\cos \left ( dx+c \right ) \sin \left ( dx+c \right ) }{d}}+abx+{\frac{abc}{d}}-{\frac{{b}^{2}\sin \left ( dx+c \right ) }{d}}+{\frac{{b}^{2}\ln \left ( \sec \left ( dx+c \right ) +\tan \left ( dx+c \right ) \right ) }{d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c))^2,x)

[Out]

1/3*a^2*sin(d*x+c)^3/d-a*b*cos(d*x+c)*sin(d*x+c)/d+a*b*x+1/d*a*b*c-b^2*sin(d*x+c)/d+1/d*b^2*ln(sec(d*x+c)+tan(
d*x+c))

________________________________________________________________________________________

Maxima [A]  time = 1.1129, size = 103, normalized size = 1.18 \begin{align*} \frac{2 \, a^{2} \sin \left (d x + c\right )^{3} + 3 \,{\left (2 \, d x + 2 \, c - \sin \left (2 \, d x + 2 \, c\right )\right )} a b + 3 \, b^{2}{\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )}}{6 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/6*(2*a^2*sin(d*x + c)^3 + 3*(2*d*x + 2*c - sin(2*d*x + 2*c))*a*b + 3*b^2*(log(sin(d*x + c) + 1) - log(sin(d*
x + c) - 1) - 2*sin(d*x + c)))/d

________________________________________________________________________________________

Fricas [A]  time = 0.528936, size = 207, normalized size = 2.38 \begin{align*} \frac{6 \, a b d x + 3 \, b^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, b^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \,{\left (a^{2} \cos \left (d x + c\right )^{2} + 3 \, a b \cos \left (d x + c\right ) - a^{2} + 3 \, b^{2}\right )} \sin \left (d x + c\right )}{6 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

1/6*(6*a*b*d*x + 3*b^2*log(sin(d*x + c) + 1) - 3*b^2*log(-sin(d*x + c) + 1) - 2*(a^2*cos(d*x + c)^2 + 3*a*b*co
s(d*x + c) - a^2 + 3*b^2)*sin(d*x + c))/d

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a \sin{\left (c + d x \right )} + b \tan{\left (c + d x \right )}\right )^{2} \cos{\left (c + d x \right )}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c))**2,x)

[Out]

Integral((a*sin(c + d*x) + b*tan(c + d*x))**2*cos(c + d*x), x)

________________________________________________________________________________________

Giac [B]  time = 5.72068, size = 7713, normalized size = 88.66 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

-1/12*a^2*sin(3*d*x + 3*c)/d + 1/4*a^2*sin(d*x + c)/d + 1/2*(2*a*b*d*x*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c)^2*
tan(c)^2 - b^2*log(2*(tan(1/2*c)^2 + 1)/(tan(1/2*d*x)^4*tan(1/2*c)^2 + 2*tan(1/2*d*x)^4*tan(1/2*c) + 2*tan(1/2
*d*x)^3*tan(1/2*c)^2 + tan(1/2*d*x)^4 + 2*tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^3 + 2*tan(1/2*d*x)*tan(
1/2*c)^2 + 2*tan(1/2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2*d*x)*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 2*tan(1/2*c) + 1)) + b^2*log(2*(ta
n(1/2*c)^2 + 1)/(tan(1/2*d*x)^4*tan(1/2*c)^2 - 2*tan(1/2*d*x)^4*tan(1/2*c) - 2*tan(1/2*d*x)^3*tan(1/2*c)^2 + t
an(1/2*d*x)^4 + 2*tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^3 - 2*tan(1/2*d*x)*tan(1/2*c)^2 + 2*tan(1/2*d*x
)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) + 2*tan(1/2*c) + 1)) - 2*a*b*tan(d*x) - 4*b^2*tan(1/2*d*x) - 4*b^2*tan(1/2
*c) - 2*a*b*tan(c))/(d*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c)^2*tan(c)^2 + d*tan(d*x)^2*tan(1/2*d*x)^2*tan(1/2*c
)^2 + d*tan(d*x)^2*tan(1/2*d*x)^2*tan(c)^2 + d*tan(d*x)^2*tan(1/2*c)^2*tan(c)^2 + d*tan(1/2*d*x)^2*tan(1/2*c)^
2*tan(c)^2 + d*tan(d*x)^2*tan(1/2*d*x)^2 + d*tan(d*x)^2*tan(1/2*c)^2 + d*tan(1/2*d*x)^2*tan(1/2*c)^2 + d*tan(d
*x)^2*tan(c)^2 + d*tan(1/2*d*x)^2*tan(c)^2 + d*tan(1/2*c)^2*tan(c)^2 + d*tan(d*x)^2 + d*tan(1/2*d*x)^2 + d*tan
(1/2*c)^2 + d*tan(c)^2 + d)